<template>
    <div class="statistics">
        <div style="border-left: 5px solid #409eff;font-size: 20px;font-weight: bold;padding-left: 10px;">
            Zero分析</div>

        <el-carousel indicator-position="outside" height="1050px" :autoplay="false">
            <el-carousel-item v-for="item in 2" :key="item">
                <!-- 销量直观图 1-6月 -->
                <div id="sales" v-if="item===1" style="width:1000px;height:500px;padding: 10px;" ref="chart"></div>
                <!-- 销量直观图 7-12月 -->
                <div id="salesTwo" v-if="item===1" style="width:1000px;height:500px;padding: 10px;" ref="chart"></div>
                <!--   销售额对比 1 - 6 月     -->
                <div id="myChart" v-if="item===2" :style="{width: '1000px', height: '500px',padding: '10px'}"></div>
                <!--   销售额对比 7 - 12 月    -->
                <div id="myChartTwo" v-if="item===2" :style="{width: '1000px', height: '500px',padding: '10px'}"></div>
            </el-carousel-item>
        </el-carousel>
    </div>
</template>

<script>
    // import echarts from 'echarts'
    import {shoppCarApi} from "@/api/ljy_port/shoppCar"
    export default {
        name: "statistics",
        data(){
          return{
              tableData:[],
              goodsOne :{one:0,two:0,three:0,four:0,five:0,six:0,seven:0,eight:0,nine:0,ten:0,eleven:0,twelve:0},
              goodsTwo :{one:0,two:0,three:0,four:0,five:0,six:0,seven:0,eight:0,nine:0,ten:0,eleven:0,twelve:0},
              goodsThree:{one:0,two:0,three:0,four:0,five:0,six:0,seven:0,eight:0,nine:0,ten:0,eleven:0,twelve:0},
              goodsFour: {one:0,two:0,three:0,four:0,five:0,six:0,seven:0,eight:0,nine:0,ten:0,eleven:0,twelve:0},
              goodsFive: {one:0,two:0,three:0,four:0,five:0,six:0,seven:0,eight:0,nine:0,ten:0,eleven:0,twelve:0},
              //
              piceOne :{one:0,two:0,three:0,four:0,five:0,six:0,seven:0,eight:0,nine:0,ten:0,eleven:0,twelve:0},
              piceTwo :{one:0,two:0,three:0,four:0,five:0,six:0,seven:0,eight:0,nine:0,ten:0,eleven:0,twelve:0},
              piceThree:{one:0,two:0,three:0,four:0,five:0,six:0,seven:0,eight:0,nine:0,ten:0,eleven:0,twelve:0},
              piceFour: {one:0,two:0,three:0,four:0,five:0,six:0,seven:0,eight:0,nine:0,ten:0,eleven:0,twelve:0},
              piceFive: {one:0,two:0,three:0,four:0,five:0,six:0,seven:0,eight:0,nine:0,ten:0,eleven:0,twelve:0}
          }
        },
        mounted(){
            this.salesVolumes();
            this.salesVolumesTwo();
            this.piceVolume();
            this.piceVolumeTwo();
            this.timer = setInterval(() =>{
                this.goodsOne = {one:0,two:0,three:0,four:0,five:0,six:0,seven:0,eight:0,nine:0,ten:0,eleven:0,twelve:0};
                this.goodsTwo  = {one:0,two:0,three:0,four:0,five:0,six:0,seven:0,eight:0,nine:0,ten:0,eleven:0,twelve:0};
                this.goodsThree = {one:0,two:0,three:0,four:0,five:0,six:0,seven:0,eight:0,nine:0,ten:0,eleven:0,twelve:0};
                this.goodsFour = {one:0,two:0,three:0,four:0,five:0,six:0,seven:0,eight:0,nine:0,ten:0,eleven:0,twelve:0};
                this.goodsFive = {one:0,two:0,three:0,four:0,five:0,six:0,seven:0,eight:0,nine:0,ten:0,eleven:0,twelve:0};
                //
                this.piceOne  = {one:0,two:0,three:0,four:0,five:0,six:0,seven:0,eight:0,nine:0,ten:0,eleven:0,twelve:0};
                this.piceTwo  = {one:0,two:0,three:0,four:0,five:0,six:0,seven:0,eight:0,nine:0,ten:0,eleven:0,twelve:0};
                this.piceThree = {one:0,two:0,three:0,four:0,five:0,six:0,seven:0,eight:0,nine:0,ten:0,eleven:0,twelve:0};
                this.piceFour = {one:0,two:0,three:0,four:0,five:0,six:0,seven:0,eight:0,nine:0,ten:0,eleven:0,twelve:0};
                this.piceFive = {one:0,two:0,three:0,four:0,five:0,six:0,seven:0,eight:0,nine:0,ten:0,eleven:0,twelve:0};
                this.salesVolumes();
                this.salesVolumesTwo();
                this.piceVolume();
                this.piceVolumeTwo();
            }, 3000);
        },
        methods:{
            //  销售数量月份处理
            goodsOneMonth(month,number){
                if (month===1){
                    this.goodsOne.one = this.goodsOne.one + number
                }
                else if(month===2){
                    this.goodsOne.two = this.goodsOne.two + number
                }
                else if(month===3){
                    this.goodsOne.three = this.goodsOne.three + number
                }
                else if(month===4){
                    this.goodsOne.four = this.goodsOne.four + number
                }
                else if(month===5){
                    this.goodsOne.five = this.goodsOne.five + number
                }
                else if(month===6){
                    this.goodsOne.six = this.goodsOne.six + number
                }
                else if(month===7){
                    this.goodsOne.seven = this.goodsOne.seven + number
                }
                else if(month===8){
                    this.goodsOne.eight = this.goodsOne.eight + number
                }
                else if(month===9){
                    this.goodsOne.nine = this.goodsOne.nine + number
                }
                else if(month===10){
                    this.goodsOne.ten = this.goodsOne.ten + number
                }
                else if(month===11){
                    this.goodsOne.eleven = this.goodsOne.eleven + number
                }
                else{
                    this.goodsOne.twelve = this.goodsOne.twelve + number
                }
            },
            goodsTwoMonth(month,number){
                if (month===1){
                    this.goodsTwo.one = this.goodsTwo.one + number
                }
                else if(month===2){
                    this.goodsTwo.two = this.goodsTwo.two + number
                }
                else if(month===3){
                    this.goodsTwo.three = this.goodsTwo.three + number
                }
                else if(month===4){
                    this.goodsTwo.four = this.goodsTwo.four + number
                }
                else if(month===5){
                    this.goodsTwo.five = this.goodsTwo.five + number
                }
                else if(month===6){
                    this.goodsTwo.six = this.goodsTwo.six + number
                }
                else if(month===7){
                    this.goodsTwo.seven = this.goodsTwo.seven + number
                }
                else if(month===8){
                    this.goodsTwo.eight = this.goodsTwo.eight + number
                }
                else if(month===9){
                    this.goodsTwo.nine = this.goodsTwo.nine + number
                }
                else if(month===10){
                    this.goodsTwo.ten = this.goodsTwo.ten + number
                }
                else if(month===11){
                    this.goodsTwo.eleven = this.goodsTwo.eleven + number
                }
                else{
                    this.goodsTwo.twelve = this.goodsTwo.twelve + number
                }
            },
            goodsThreeMonth(month,number){
                if (month===1){
                    this.goodsThree.one = this.goodsThree.one + number
                }
                else if(month===2){
                    this.goodsThree.two = this.goodsThree.two + number
                }
                else if(month===3){
                    this.goodsThree.three = this.goodsThree.three + number
                }
                else if(month===4){
                    this.goodsThree.four = this.goodsThree.four + number
                }
                else if(month===5){
                    this.goodsThree.five = this.goodsThree.five + number
                }
                else if(month===6){
                    this.goodsThree.six = this.goodsThree.six + number
                }
                else if(month===7){
                    this.goodsThree.seven = this.goodsThree.seven + number
                }
                else if(month===8){
                    this.goodsThree.eight = this.goodsThree.eight + number
                }
                else if(month===9){
                    this.goodsThree.nine = this.goodsThree.nine + number
                }
                else if(month===10){
                    this.goodsThree.ten = this.goodsThree.ten + number
                }
                else if(month===11){
                    this.goodsThree.eleven = this.goodsThree.eleven + number
                }
                else{
                    this.goodsThree.twelve = this.goodsThree.twelve + number
                }
            },
            goodsFourMonth(month,number){
                if (month===1){
                    this.goodsFour.one = this.goodsFour.one + number
                }
                else if(month===2){
                    this.goodsFour.two = this.goodsFour.two + number
                }
                else if(month===3){
                    this.goodsFour.three = this.goodsFour.three + number
                }
                else if(month===4){
                    this.goodsFour.four = this.goodsFour.four + number
                }
                else if(month===5){
                    this.goodsFour.five = this.goodsFour.five + number
                }
                else if(month===6){
                    this.goodsFour.six = this.goodsFour.six + number
                }
                else if(month===7){
                    this.goodsFour.seven = this.goodsFour.seven + number
                }
                else if(month===8){
                    this.goodsFour.eight = this.goodsFour.eight + number
                }
                else if(month===9){
                    this.goodsFour.nine = this.goodsFour.nine + number
                }
                else if(month===10){
                    this.goodsFour.ten = this.goodsFour.ten + number
                }
                else if(month===11){
                    this.goodsFour.eleven = this.goodsFour.eleven + number
                }
                else{
                    this.goodsFour.twelve = this.goodsFour.twelve + number
                }
            },
            goodsFiveMonth(month,number){
                if (month===1){
                    this.goodsFive.one = this.goodsFive.one + number
                }
                else if(month===2){
                    this.goodsFive.two = this.goodsFive.two + number
                }
                else if(month===3){
                    this.goodsFive.three = this.goodsFive.three + number
                }
                else if(month===4){
                    this.goodsFive.four = this.goodsFive.four + number
                }
                else if(month===5){
                    this.goodsFive.five = this.goodsFive.five + number
                }
                else if(month===6){
                    this.goodsFive.six = this.goodsFive.six + number
                }
                else if(month===7){
                    this.goodsFive.seven = this.goodsFive.seven + number
                }
                else if(month===8){
                    this.goodsFive.eight = this.goodsFive.eight + number
                }
                else if(month===9){
                    this.goodsFive.nine = this.goodsFive.nine + number
                }
                else if(month===10){
                    this.goodsFive.ten = this.goodsFive.ten + number
                }
                else if(month===11){
                    this.goodsFive.eleven = this.goodsFive.eleven + number
                }
                else{
                    this.goodsFive.twelve = this.goodsFive.twelve + number
                }
            },
            //  销售数量 1 - 6 月
            async salesVolumes () {
                //  销量分析
                shoppCarApi(1, 99999).then(req => {
                    this.tableData = req.data.content;
                    this.tableData.forEach(item=> {
                        if (item.buy_address ==='手镯'){
                            let timestr =  new Date(parseInt(item.buy_time));
                            let month = timestr.getMonth()+1
                            this.goodsOneMonth(month,item.buy_number);
                        }else if(item.buy_address ==='项链'){
                            let timestr =  new Date(parseInt(item.buy_time));
                            let month = timestr.getMonth()+1
                            this.goodsTwoMonth(month,item.buy_number);
                        }else if(item.buy_address ==='手表'){
                            let timestr =  new Date(parseInt(item.buy_time));
                            let month = timestr.getMonth()+1
                            this.goodsThreeMonth(month,item.buy_number);
                        }else if(item.buy_address ==='首饰'){
                            let timestr =  new Date(parseInt(item.buy_time));
                            let month = timestr.getMonth()+1
                            this.goodsFourMonth(month,item.buy_number);
                        }else{
                            let timestr =  new Date(parseInt(item.buy_time));
                            let month = timestr.getMonth()+1
                            this.goodsFiveMonth(month,item.buy_number);
                        }
                    })
                    let myChart = this.$echarts.init(document.getElementById('sales'));
                    // console.log(this.$refs.chart)
                    // 绘制图表
                    myChart.setOption({
                        title: {
                            text: '销售量/套',
                            subtext: '1月-6月'},
                        legend: {
                            data:["手镯","项链","手表","首饰","戒指"]
                        },
                        tooltip: {
                            trigger: 'axis'
                        },
                        xAxis: {
                            data: ["一月","二月","三月","四月","五月","六月"]
                        },
                        yAxis: {},
                        series: [
                            {
                            name: '手镯',
                            type: 'bar',
                            // data: [ones, twos, threes, fours, fives]
                            data:[
                                this.goodsOne.one,
                                this.goodsOne.two,
                                this.goodsOne.three,
                                this.goodsOne.four,
                                this.goodsOne.five,
                                this.goodsOne.six]
                        },
                            {
                                name: '项链',
                                type: 'bar',
                                // data: [ones, twos, threes, fours, fives]
                                data:[
                                    this.goodsTwo.one,
                                    this.goodsTwo.two,
                                    this.goodsTwo.three,
                                    this.goodsTwo.four,
                                    this.goodsTwo.five,
                                    this.goodsTwo.six]
                            },
                            {
                                name: '手表',
                                type: 'bar',
                                // data: [ones, twos, threes, fours, fives]
                                data:[
                                    this.goodsThree.one,
                                    this.goodsThree.two,
                                    this.goodsThree.three,
                                    this.goodsThree.four,
                                    this.goodsThree.five,
                                    this.goodsThree.six]
                            },
                            {
                                name: '首饰',
                                type: 'bar',
                                data:[
                                    this.goodsFour.one,
                                    this.goodsFour.two,
                                    this.goodsFour.three,
                                    this.goodsFour.four,
                                    this.goodsFour.five,
                                    this.goodsFour.six]
                            },
                            {
                                name: '戒指',
                                type: 'bar',
                                // data: [ones, twos, threes, fours, fives]
                                data:[
                                    this.goodsFive.one,
                                    this.goodsFive.two,
                                    this.goodsFive.three,
                                    this.goodsFive.four,
                                    this.goodsFive.five,
                                    this.goodsFive.six]
                            }
                            ]
                    });
                })
            },
            //  销售数量 7 - 12 月
            async salesVolumesTwo () {
                //  销量分析
                shoppCarApi(1, 99999).then(req => {
                    this.tableData = req.data.content
                    this.tableData.forEach(item=> {
                        if (item.buy_address ==='手镯'){
                            let timestr =  new Date(parseInt(item.buy_time));
                            let month = timestr.getMonth()+1
                            this.goodsOneMonth(month,item.buy_number);
                        }else if(item.buy_address ==='项链'){
                            let timestr =  new Date(parseInt(item.buy_time));
                            let month = timestr.getMonth()+1
                            this.goodsTwoMonth(month,item.buy_number);
                        }else if(item.buy_address ==='手表'){
                            let timestr =  new Date(parseInt(item.buy_time));
                            let month = timestr.getMonth()+1
                            this.goodsThreeMonth(month,item.buy_number);
                        }else if(item.buy_address ==='首饰'){
                            let timestr =  new Date(parseInt(item.buy_time));
                            let month = timestr.getMonth()+1
                            this.goodsFourMonth(month,item.buy_number);
                        }else{
                            let timestr =  new Date(parseInt(item.buy_time));
                            let month = timestr.getMonth()+1
                            this.goodsFiveMonth(month,item.buy_number);
                        }
                    })
                    let myChart = this.$echarts.init(document.getElementById('salesTwo'));
                    // console.log(this.$refs.chart)
                    // 绘制图表
                    myChart.setOption({
                        title: {
                            text: '',
                            subtext: '7月-12月'},
                        legend: {
                            data:["手镯","项链","手表","首饰","戒指"]
                        },
                        tooltip: {
                            trigger: 'axis'
                        },
                        xAxis: {
                            data: ["七月","八月","九月","十月","十一月","十二月"]
                        },
                        yAxis: {},
                        series: [
                            {
                                name: '手镯',
                                type: 'bar',
                                data:[
                                    this.goodsOne.seven,
                                    this.goodsOne.eight,
                                    this.goodsOne.nine,
                                    this.goodsOne.ten,
                                    this.goodsOne.eleven,
                                    this.goodsOne.twelve]
                            },
                            {
                                name: '项链',
                                type: 'bar',
                                data:[
                                    this.goodsTwo.seven,
                                    this.goodsTwo.eight,
                                    this.goodsTwo.nine,
                                    this.goodsTwo.ten,
                                    this.goodsTwo.eleven,
                                    this.goodsTwo.twelve]
                            },
                            {
                                name: '手表',
                                type: 'bar',
                                data:[
                                    this.goodsThree.seven,
                                    this.goodsThree.eight,
                                    this.goodsThree.nine,
                                    this.goodsThree.ten,
                                    this.goodsThree.eleven,
                                    this.goodsThree.twelve]
                            },
                            {
                                name: '首饰',
                                type: 'bar',
                                data:[
                                    this.goodsFour.seven,
                                    this.goodsFour.eight,
                                    this.goodsFour.nine,
                                    this.goodsFour.ten,
                                    this.goodsFour.eleven,
                                    this.goodsFour.twelve]
                            },
                            {
                                name: '戒指',
                                type: 'bar',
                                data:[
                                    this.goodsFive.seven,
                                    this.goodsFive.eight,
                                    this.goodsFive.nine,
                                    this.goodsFive.ten,
                                    this.goodsFive.eleven,
                                    this.goodsFive.twelve]
                            }
                        ]
                    });
                })
            },

            //  销售额度月份处理
            piceOneMonth(month,number){
                if (month===1){
                    this.piceOne.one = this.piceOne.one + number
                }
                else if(month===2){
                    this.piceOne.two = this.piceOne.two + number
                }
                else if(month===3){
                    this.piceOne.three = this.piceOne.three + number
                }
                else if(month===4){
                    this.piceOne.four = this.piceOne.four + number
                }
                else if(month===5){
                    this.piceOne.five = this.piceOne.five + number
                }
                else if(month===6){
                    this.piceOne.six = this.piceOne.six + number
                }
                else if(month===7){
                    this.piceOne.seven = this.piceOne.seven + number
                }
                else if(month===8){
                    this.piceOne.eight = this.piceOne.eight + number
                }
                else if(month===9){
                    this.piceOne.nine = this.piceOne.nine + number
                }
                else if(month===10){
                    this.piceOne.ten = this.piceOne.ten + number
                }
                else if(month===11){
                    this.piceOne.eleven = this.piceOne.eleven + number
                }
                else{
                    this.piceOne.twelve = this.piceOne.twelve + number
                }
            },
            piceTwoMonth(month,number){
                if (month===1){
                    this.piceTwo.one = this.piceTwo.one + number
                }
                else if(month===2){
                    this.piceTwo.two = this.piceTwo.two + number
                }
                else if(month===3){
                    this.piceTwo.three = this.piceTwo.three + number
                }
                else if(month===4){
                    this.piceTwo.four = this.piceTwo.four + number
                }
                else if(month===5){
                    this.piceTwo.five = this.piceTwo.five + number
                }
                else if(month===6){
                    this.piceTwo.six = this.piceTwo.six + number
                }
                else if(month===7){
                    this.piceTwo.seven = this.piceTwo.seven + number
                }
                else if(month===8){
                    this.piceTwo.eight = this.piceTwo.eight + number
                }
                else if(month===9){
                    this.piceTwo.nine = this.piceTwo.nine + number
                }
                else if(month===10){
                    this.piceTwo.ten = this.piceTwo.ten + number
                }
                else if(month===11){
                    this.piceTwo.eleven = this.piceTwo.eleven + number
                }
                else{
                    this.piceTwo.twelve = this.piceTwo.twelve + number
                }
            },
            piceThreeMonth(month,number){
                if (month===1){
                    this.piceThree.one = this.piceThree.one + number
                }
                else if(month===2){
                    this.piceThree.two = this.piceThree.two + number
                }
                else if(month===3){
                    this.piceThree.three = this.piceThree.three + number
                }
                else if(month===4){
                    this.piceThree.four = this.piceThree.four + number
                }
                else if(month===5){
                    this.piceThree.five = this.piceThree.five + number
                }
                else if(month===6){
                    this.piceThree.six = this.piceThree.six + number
                }
                else if(month===7){
                    this.piceThree.seven = this.piceThree.seven + number
                }
                else if(month===8){
                    this.piceThree.eight = this.piceThree.eight + number
                }
                else if(month===9){
                    this.piceThree.nine = this.piceThree.nine + number
                }
                else if(month===10){
                    this.piceThree.ten = this.piceThree.ten + number
                }
                else if(month===11){
                    this.piceThree.eleven = this.piceThree.eleven + number
                }
                else{
                    this.piceThree.twelve = this.piceThree.twelve + number
                }
            },
            piceFourMonth(month,number){
                if (month===1){
                    this.piceFour.one = this.piceFour.one + number
                }
                else if(month===2){
                    this.piceFour.two = this.piceFour.two + number
                }
                else if(month===3){
                    this.piceFour.three = this.piceFour.three + number
                }
                else if(month===4){
                    this.piceFour.four = this.piceFour.four + number
                }
                else if(month===5){
                    this.piceFour.five = this.piceFour.five + number
                }
                else if(month===6){
                    this.piceFour.six = this.piceFour.six + number
                }
                else if(month===7){
                    this.piceFour.seven = this.piceFour.seven + number
                }
                else if(month===8){
                    this.piceFour.eight = this.piceFour.eight + number
                }
                else if(month===9){
                    this.piceFour.nine = this.piceFour.nine + number
                }
                else if(month===10){
                    this.piceFour.ten = this.piceFour.ten + number
                }
                else if(month===11){
                    this.piceFour.eleven = this.piceFour.eleven + number
                }
                else{
                    this.piceFour.twelve = this.piceFour.twelve + number
                }
            },
            piceFiveMonth(month,number){
                if (month===1){
                    this.piceFive.one = this.piceFive.one + number
                }
                else if(month===2){
                    this.piceFive.two = this.piceFive.two + number
                }
                else if(month===3){
                    this.piceFive.three = this.piceFive.three + number
                }
                else if(month===4){
                    this.piceFive.four = this.piceFive.four + number
                }
                else if(month===5){
                    this.piceFive.five = this.piceFive.five + number
                }
                else if(month===6){
                    this.piceFive.six = this.piceFive.six + number
                }
                else if(month===7){
                    this.piceFive.seven = this.piceFive.seven + number
                }
                else if(month===8){
                    this.piceFive.eight = this.piceFive.eight + number
                }
                else if(month===9){
                    this.piceFive.nine = this.piceFive.nine + number
                }
                else if(month===10){
                    this.piceFive.ten = this.piceFive.ten + number
                }
                else if(month===11){
                    this.piceFive.eleven = this.piceFive.eleven + number
                }
                else{
                    this.piceFive.twelve = this.piceFive.twelve + number
                }
            },
            // 销售额 1 - 6 月
            async piceVolume(){
                shoppCarApi(1, 99999).then(req => {
                        this.tableData = req.data.content
                        this.tableData.forEach(item=> {
                            if (item.buy_address ==='手镯'){
                                let timestr =  new Date(parseInt(item.buy_time));
                                let month = timestr.getMonth()+1
                                this.piceOneMonth(month,(item.buy_number * parseInt(item.goods_pice)));
                            }else if(item.buy_address ==='项链'){
                                let timestr =  new Date(parseInt(item.buy_time));
                                let month = timestr.getMonth()+1
                                this.piceTwoMonth(month,(item.buy_number * parseInt(item.goods_pice)));
                            }else if(item.buy_address ==='手表'){
                                let timestr =  new Date(parseInt(item.buy_time));
                                let month = timestr.getMonth()+1
                                this.piceThreeMonth(month,(item.buy_number * parseInt(item.goods_pice)));
                            }else if(item.buy_address ==='首饰'){
                                let timestr =  new Date(parseInt(item.buy_time));
                                let month = timestr.getMonth()+1
                                this.piceFourMonth(month,(item.buy_number * parseInt(item.goods_pice)));
                            }else{
                                let timestr =  new Date(parseInt(item.buy_time));
                                let month = timestr.getMonth()+1
                                this.piceFiveMonth(month,(item.buy_number * parseInt(item.goods_pice)));
                            }
                        })
                let myChart = this.$echarts.init(document.getElementById('myChart'));
                myChart.setOption({
                    title: {
                        text: '销售额分析/元',
                        subtext: '1月-6月'
                    },
                    tooltip: {
                        trigger: 'axis'
                    },
                    legend: {
                        data:['今年','去年']
                    },
                    toolbox: {
                        show: true,
                        feature: {
                            dataZoom: {
                                yAxisIndex: 'none'
                            },
                            dataView: {readOnly: false},
                            magicType: {type: ['line', 'bar']},
                            restore: {},
                            saveAsImage: {}
                        }
                    },
                    xAxis:  {
                        type: 'category',
                        boundaryGap: false,
                        data: ['一月','二月','三月','四月','五月','六月']
                    },
                    yAxis: {
                        type: 'value',
                        axisLabel: {
                            formatter: '{value}'
                        }
                    },
                    series: [
                        {
                            name:'今年',
                            type:'line',
                            data: [this.piceOne.one,
                                this.piceOne.two,
                                this.piceOne.three,
                                this.piceOne.four,
                                this.piceOne.five,
                                this.piceOne.six],
                            markPoint: {
                                data: [
                                    {type: 'max', name: '最大值'},
                                    {type: 'min', name: '最小值'}
                                ]
                            },
                            markLine: {
                                data: [
                                    {type: 'average', name: '平均值'}
                                ]
                            }
                        },
                        {
                            name:'去年',
                            type:'line',
                            data:[92105,52123,24321,31231,73810,51313],
                            markPoint: {
                                data: [
                                    {type: 'max', name: '最大值'},
                                    {type: 'min', name: '最小值'}
                                ]
                            },
                            markLine: {
                                data: [
                                    {type: 'average', name: '平均值'}
                                ]
                            }
                        }
                    ]
                });
                })
            },
            // 销售额 7 - 12 月
            async piceVolumeTwo(){
                shoppCarApi(1, 99999).then(req => {
                    this.tableData = req.data.content
                    this.tableData.forEach(item=> {
                        if (item.buy_address ==='手镯'){
                            let timestr =  new Date(parseInt(item.buy_time));
                            let month = timestr.getMonth()+1
                            this.piceOneMonth(month,(item.buy_number * parseInt(item.goods_pice)));
                        }else if(item.buy_address ==='项链'){
                            let timestr =  new Date(parseInt(item.buy_time));
                            let month = timestr.getMonth()+1
                            this.piceTwoMonth(month,(item.buy_number * parseInt(item.goods_pice)));
                        }else if(item.buy_address ==='手表'){
                            let timestr =  new Date(parseInt(item.buy_time));
                            let month = timestr.getMonth()+1
                            this.piceThreeMonth(month,(item.buy_number * parseInt(item.goods_pice)));
                        }else if(item.buy_address ==='首饰'){
                            let timestr =  new Date(parseInt(item.buy_time));
                            let month = timestr.getMonth()+1
                            this.piceFourMonth(month,(item.buy_number * parseInt(item.goods_pice)));
                        }else{
                            let timestr =  new Date(parseInt(item.buy_time));
                            let month = timestr.getMonth()+1
                            this.piceFiveMonth(month,(item.buy_number * parseInt(item.goods_pice)));
                        }
                    })
                let myChart = this.$echarts.init(document.getElementById('myChartTwo'));
                // 绘制图表
                myChart.setOption({
                    title: {
                        text: '',
                        subtext: '7月-12月'
                    },
                    tooltip: {
                        trigger: 'axis'
                    },
                    legend: {
                        data:['今年','去年']
                    },
                    toolbox: {
                        show: true,
                        feature: {
                            dataZoom: {
                                yAxisIndex: 'none'
                            },
                            dataView: {readOnly: false},
                            magicType: {type: ['line', 'bar']},
                            restore: {},
                            saveAsImage: {}
                        }
                    },
                    xAxis:  {
                        type: 'category',
                        boundaryGap: false,
                        data: ['七月','八月','九月','十月','十一月','十二月']
                    },
                    yAxis: {
                        type: 'value',
                        axisLabel: {
                            formatter: '{value}'
                        }
                    },
                    series: [
                        {
                            name:'今年',
                            type:'line',
                            data:[
                                this.piceOne.seven,
                                this.piceOne.eight,
                                this.piceOne.nine,
                                this.piceOne.ten,
                                this.piceOne.eleven,
                                this.piceOne.twelve],
                            markPoint: {
                                data: [
                                    {type: 'max', name: '最大值'},
                                    {type: 'min', name: '最小值'}
                                ]
                            },
                            markLine: {
                                data: [
                                    {type: 'average', name: '平均值'}
                                ]
                            }
                        },
                        {
                            name:'去年',
                            type:'line',
                            data:[38192, 36271, 29870, 72306, 20123, 9878],
                            markPoint: {
                                data: [
                                    {type: 'max', name: '最大值'},
                                    {type: 'min', name: '最小值'}
                                ]
                            },
                            markLine: {
                                data: [
                                    {type: 'average', name: '平均值'}
                                ]
                            }
                        }
                    ]
                });
                })
            }
        },
        beforeDestroy() {
            clearInterval(this.timer);
        }
    }
</script>

<style lang="scss" scoped>
.statistics{

}
</style>
